package com.poxz.common.exception;

import com.poxz.common.response.ResultCode;
import lombok.Getter;

/**
 * 业务异常类
 *
 * @author poxz
 */
@Getter
public class BusinessException extends RuntimeException {
    /**
     * 状态码
     */
    private final ResultCode resultCode;

    /**
     * 状态码构造方法
     *
     * @param resultCode 结果码
     */
    public BusinessException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode;
    }

    /**
     * 自定义消息构造方法
     *
     * @param resultCode 结果码
     * @param message 消息内容
     */
    public BusinessException(ResultCode resultCode, String message) {
        super(message);
        this.resultCode = resultCode;
    }
}
